public class demo11 {
    public static  boolean isfinshed=false;
    public static void main(String[] args) throws InterruptedException {
//        boolean isfinshed=false;
        Thread t=new Thread(()->{
            while(!isfinshed){
                System.out.println("hello run");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("thread over");
        });
        t.start();
        Thread.sleep(3000);
        isfinshed=true;
    }
}
